<%@ page contentType="text/html;charset=gb2312" import="java.sql.*"%>
<%@ include file="check.jsp"%>
<jsp:useBean id="conn" class="dbBean.DBBean" scope="session"/>
<%
String id="0";
String truename="";
String password="";
String sex="";
String age="";
String idcard="";
String phone="";
String email="";
String address="";
String rank="0";
String logrank="";
String logid="";
ResultSet rs=null;
request.setCharacterEncoding("gb2312");
if(session.getAttribute("rank")!=null)
	logrank=(String)session.getAttribute("rank");
if(session.getAttribute("id")!=null)
	logid=(String)session.getAttribute("id");
if(request.getParameter("updateid")!=null)
	id=request.getParameter("updateid");
if(!logrank.equals("1")&&!logid.equals(id))
	response.sendRedirect("error.jsp");
else{
if(request.getParameter("password")!=null)
	password=request.getParameter("password");
if(request.getParameter("truename")!=null)
	truename=request.getParameter("truename");
if(request.getParameter("sex")!=null)
	sex=request.getParameter("sex");
if(request.getParameter("age")!=null)
	age=request.getParameter("age");
if(request.getParameter("idcard")!=null)
	idcard=request.getParameter("idcard");
if(request.getParameter("phone")!=null)
	phone=request.getParameter("phone");
if(request.getParameter("email")!=null)
	email=request.getParameter("email");
if(request.getParameter("address")!=null)
	address=request.getParameter("address");
if(request.getParameter("rank")!=null)
	rank=request.getParameter("rank");

	String sql="update user set truename='"+truename+"',password='"+password+"',sex='"+sex+"',age='"+age+"',IDcard='"+idcard+"',phone='"+phone+"',email='"+email+"',address='"+address+"' where userid="+id;
	conn.executeUpdate(sql);
	conn.close();
	if(logrank.equals("1"))
		response.sendRedirect("manageuser.jsp");
	else
		response.sendRedirect("list.jsp");
}
%>
	
